//
//  NSString+StringCustom.h
//  ADYiZhiYu
//
//  Created by 晓 on 2017/10/31.
//  Copyright © 2017年 com.idolmedia. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TYTextContainer.h"
@interface NSString (StringCustom)

/*
 contentStr: 总的字符串
 rangeStr: 要改变的字符串
 contentFont: 总字符串的大小
 rangeFont: 要改变的字符串的文字的大小
 contentColor: 总字符串的颜色
 rangeColor: 要改变的字符串的文字的颜色
 */
+ (NSMutableAttributedString *)contenetStr:(NSString *)contentStr rangeStr:(NSString *)rangeStr contentFont:(UIFont*)contentFont rangeFont:(UIFont*)rangeFont contentColor:(UIColor *)contentColor rangeColor:(UIColor *)rangeColor;
//加行间距
+ (NSMutableAttributedString *)contenetStr:(NSString *)contentStr rangeStr:(NSString *)rangeStr contentFont:(UIFont*)contentFont rangeFont:(UIFont*)rangeFont contentColor:(UIColor *)contentColor rangeColor:(UIColor *)rangeColor WithSpace:(float)space;


//添加中划线
+ (NSMutableAttributedString *)underlineContenetStr:(NSString *)contentStr rangeStr:(NSString *)rangeStr contentFont:(UIFont*)contentFont rangeFont:(UIFont*)rangeFont contentColor:(UIColor *)contentColor rangeColor:(UIColor *)rangeColor;



/**
 label上带标签

 @param contentStr 内容
 @param contentColor 内容的颜色
 @param contentFont 内容的字体
 @param rangeStr 变化的文字
 @param rangBackgroundColor 变化文字的背景色
 @param rangeFont 变化文字的大小
 @param rangeCorner aa
 @param rangRectCorner aa
 @param viewWidth 文字的整体宽度
 @return return value description
 */
+(TYTextContainer *)stringWithContentStr:(NSString *)contentStr contentColor:(UIColor *)contentColor contentFont:(CGFloat)contentFont rangeStr:(NSString *)rangeStr rangBackgroundColor:(UIColor *)rangBackgroundColor rangeFont:(CGFloat)rangeFont rangeCorner:(CGFloat)rangeCorner rangeRectCorner:(UIRectCorner)rangRectCorner withViewWidth:(CGFloat )viewWidth;

/**
 计算label的宽高
 @param text label的text
 @param font 字体大小
 @param maxSize 最大值
 @return return value description
 */
+ (CGSize)labelAutoCalculateRectWith:(NSString*)text WithFont:(UIFont *)font MaxSize:(CGSize)maxSize;

//加行间距计算Label的长度
+(CGSize)labelAutoCalculateRectWith:(NSString*)text WithFont:(UIFont *)font MaxSize:(CGSize)maxSize WithSpace:(float)space;

- (float)widthWithFont:(UIFont *)font limitHeight:(float)height;

- (float)heightWithFont:(UIFont *)font limitWidth:(float)width;


//字符串转NSMutableAttributedString
+(NSMutableAttributedString *)contentString:(NSString *)str;

//字符串转成字典
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

//字典转成字符串
+ (NSString*)dictionaryToJson:(NSDictionary *)dic;
//数组转成字符串
+ (NSString *)arrayToJSONString:(NSArray *)array;

//去掉 小数后面的0
+(NSString*)removeFloatAllZero:(NSString*)string;
//手机型号
+ (NSString *)iphoneType;

//判断图片类型
+ (NSString *)contentTypeForImageData:(NSData *)data;


//encode编码（社区详情分享到web用）
+ (NSString *)encodeToPercentEscapeString: (NSString *)input;
//解码
+ (NSString *)decodeFromPercentEscapeString: (NSString *)input;

- (NSString *)URLEncodedString;

- (NSString *)URLDecodedString;

//时间戳转换
+ (NSString *)timeBeforeInfoWithString:(NSTimeInterval)timeIntrval;

//时间转时间戳
+(NSInteger)timeSwitchTimestamp:(NSString *)formatTime;

//时间戳转时间
+(NSString *)getTimeFromTimestamp:(NSString *)formatTime;

//获取当前年份、月份、日期
+(NSInteger)getMonthTimeFromTimestamp:(NSString *)formatTime;

//获取当前时间 format:YYYY-MM-dd HH:mm:ss
+(NSString*)getCurrentTimesAndFormat:(NSString *)format;

+(NSString *)getJiDu;

//去除null
+(NSString *)passNullForString:(id)str;

//js的encodeURIComponent
+ (NSString *)URLEncodedString:(NSString *)str;

//webview 加载html
+(NSString *)webLoadStrForContentStr:(NSString *)contentString;

//字符串改颜色
+(NSMutableAttributedString *)contentString:(NSString *)contentStr subString:(NSString *)subStr subColor:(UIColor *)subColor subFont:(UIFont *)subFont;

//当前时间戳
+(NSString *)getNowTimeTimestamp;


@end
